<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}
#l-map{height:100%;width:78%;float:left;border-right:2px solid #bcbcbc;}
#r-result{height:100%;width:20%;float:left;}
</style>
<link rel="stylesheet" type="text/css" href="${path}/css/scxnTabDiv.css"/>
<link rel="stylesheet" type="text/css" href="${path}/css/baidu.css" />
</head>
<body>
	<div id="info_div" style="width='280px';height='200px;'"></div>
	<!--startprint-->
	<div id="allmap" onselectstart="return false;" oncontextmenu="closePolyLine();enableDragging();" style="height: 100%;position:relative;">
	</div>
	<!--endprint-->
</body>
</html>
<script type="text/javascript" src="${path}/js/BaiduApi_2.0.js"></script>
<script type="text/javascript" src="${path}/js/AreaRestriction_min.js"></script>
<script type="text/javascript" src="${path}/js/TextIconOverlay_min.js"></script>
<script type="text/javascript" src="${path}/js/DistanceTool_min.js"></script>
<script type="text/javascript" src="${path}/js/data_Map.js"></script>
<script type="text/javascript" src="${path}/js/RectangleZoom_min.js"></script>
<script src="${path}/baiduTilesInfo.js"></script>
<script type="text/javascript">
var defaultCursor = null;
var lineArray = new Array();		//线集合
var currLine = "";					//当前画线
var polyflag = false;				//画线开关
var defaultCursor = null;
var isFixedMap = false;

var tileLayer = new BMap.TileLayer();
tileLayer.getTilesUrl = function(tileCoord, zoom) {
	var x = tileCoord.x;
	var y = tileCoord.y;
	var url = outputPath + zoom + '/' + x + '/' + y + format;
	return url;
}
var tileMapType = new BMap.MapType('tileMapType', tileLayer, {minZoom: minLevel, maxZoom: maxLevel});
var map = new BMap.Map('allmap', {mapType: tileMapType});

//初始化鼠标
defaultCursor = map.getDefaultCursor();
// 定位到地图中心点
map.centerAndZoom(new BMap.Point(centX, centY), 12);
// 添加导航控件
map.addControl(new BMap.NavigationControl()); 
// 添加比例尺控件
map.addControl(new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT}));
// 启用滚轮放大缩小
map.enableScrollWheelZoom();
map.enableContinuousZoom();
//启用键盘操作
map.enableKeyboard();

// 添加点击事件
map.addEventListener('click', function(e) {
	//画线
	document.getElementById("info_div").innerHTML = e.point.lng+","+e.point.lat;
	if(polyflag){
		if(currLine!=""){
			currLine+= ";";
			map.removeOverlay(lineArray.pop());
		}
		currLine+=e.point.lng+","+e.point.lat;
		lineArray.push(addPolyline(currLine,"#ff0000",0.8,3));
	}
});


// 创建用户自定义地标
if(pointsStr!=""){
	var points = pointsStr.split("##");
	for(var i=0;i<points.length;i++)
	{
		var point = points[i];
		var info = point.split('$');
		addMarker(parseFloat(info[1]), parseFloat(info[0]), info[2], "images/marker_red_sprite.png", 23, 25);
	}
}

//添加自定义Marker标注
function addMarker(lng, lat, markerInfo, iconCursor, cursorWidth, cursorHeight) {
	if (cursorWidth == null) {
		cursorWidth = 23;
	}
	if (cursorHeight == null) {
		cursorHeight = 25;
	}
	var marker;
	if (iconCursor != null) {
		var myIcon = new BMap.Icon(iconCursor, new BMap.Size(cursorWidth, cursorHeight));      
		marker = new BMap.Marker(new BMap.Point(lng,lat), {
			icon: myIcon
		}); // 创建标注
	} else {
		marker = new BMap.Marker(new BMap.Point(lng,lat)); // 创建标注
	}
	map.addOverlay(marker); // 将标注添加到地图中
	if(markerInfo!=null){
		marker.addEventListener("click", function(){
			alert(markerInfo);
		});
	}
}
addMarker(116.405611,39.891844,'标记');

</script>